/*****************************************************************************
 *
 *                      HUSONG PROPRIETARY INFORMATION
 *
 *          The information contained herein is proprietary to HUSONG
 *           and shall not be reproduced or disclosed in whole or in part
 *                    or used for any design or manufacture
 *              without direct written authorization from HUSONG.
 *
 *            Copyright (c) 2015 by HUSONG.  All rights reserved.
 *
 *****************************************************************************/
package me.send.data.service.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import me.send.data.service.pojo.ActivitySchoolFastfoodOrder;

/**
 * @author maxmin
 *
 * @date 2015年10月27日 上午11:37:36
 */
public interface ActivitySchoolFastfoodOrderMapper {
	
	@Insert(value="INSERT INTO activity_school_fastfood_order (orderid,fastfood_id,num,createtime,is_discount,price,discount_price,count_discount_price,count_price) "
			+ "VALUES(#{orderid},#{fastfoodId},#{num},#{createtime},#{isDiscount},#{price},#{discountPrice},#{countDiscountPrice},#{countPrice})")
	int insertActivitSchoolFastfoodOrder(ActivitySchoolFastfoodOrder activitySchoolFastfoodOrder);
	
	@Select(value="SELECT * FROM activity_school_fastfood_order asfo LEFT JOIN orders o ON asfo.orderid = o.orderid "
			+ "WHERE o.userid = #{userid} AND STR_TO_DATE(o.createtime,'%Y-%m-%d')=#{date} AND asfo.is_discount = 1 AND o.isdelete=0")
	List<ActivitySchoolFastfoodOrder> getActivitySchoolFastfoodOrders(Map<String, Object>params);
}
